import {Http} from '@angular/http';
import {NgLayer, NgLayerRef} from 'ng2-layer';
import {ActivatedRoute} from '@angular/router';
import {Component,ViewContainerRef, Injectable}  from '@angular/core';
/**
 * 左侧菜单部分
 */
@Component({
	selector: '.box_notice',
	templateUrl: 'template/router/boxSetting/notice.html'
})
export class BoxNoticeComp {
	constructor(
	private http:Http,
	router:ActivatedRoute,
	private layer:NgLayer,
	private parent:ViewContainerRef){
		
		router.parent.params.subscribe(params => {
			this.boxId = params.id;
			http.get({
				search:{
					m:"Admin",
					c:"ApiBox",
					a:"getBoxAnnouncement",
					box_id:this.boxId
				}
			}).then((data)=>{
				this.announcement = data.data.announcement;
			});
		});
	}
	
	/**
	 * 
	 */
	saveAnnouncement(){
		this.http.post({
			search:{
				m:"Admin",
				c:"ApiBox",
				a:"updateBox",
				box_id:this.boxId
			},
			body:{announcement:this.announcement}
		}).then((data)=>{
			
		});
	}
}